[HVM] Fix bugs in RTC alarm code.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 27 Nov 2006 10:14:45 +0000 (10:14 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 27 Nov 2006 10:14:45 +0000 (10:14 +0000)
 - comparing bcd with binary data
 - comparing min with mon

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
xen/arch/x86/hvm/rtc.c

index ea7f0ce9dff32294abe8a726764a1daf6ce0df41..1f26dc92526fbb0e8e6a54b5a84cf846bad8936f 100644 (file)
@@ -282,11 +282,14 @@ static void rtc_update_second2(void *opaque)
     if ( s->cmos_data[RTC_REG_B] & RTC_AIE )
     {
         if ( ((s->cmos_data[RTC_SECONDS_ALARM] & 0xc0) == 0xc0 ||
-              s->cmos_data[RTC_SECONDS_ALARM] == s->current_tm.tm_sec) &&
+              from_bcd(s, s->cmos_data[RTC_SECONDS_ALARM]) ==
+              s->current_tm.tm_sec) &&
              ((s->cmos_data[RTC_MINUTES_ALARM] & 0xc0) == 0xc0 ||
-              s->cmos_data[RTC_MINUTES_ALARM] == s->current_tm.tm_mon) &&
+              from_bcd(s, s->cmos_data[RTC_MINUTES_ALARM]) ==
+              s->current_tm.tm_min) &&
              ((s->cmos_data[RTC_HOURS_ALARM] & 0xc0) == 0xc0 ||
-              s->cmos_data[RTC_HOURS_ALARM] == s->current_tm.tm_hour) )
+              from_bcd(s, s->cmos_data[RTC_HOURS_ALARM]) ==
+              s->current_tm.tm_hour) )
         {
             s->cmos_data[RTC_REG_C] |= 0xa0; 
             hvm_isa_irq_deassert(s->vcpu->domain, s->irq);